#include "cpu/exec/template-start.h"

#define instr ret

#if DATA_BYTE == 4
make_helper(ret) {
	cpu.eip = MEM_R(cpu.esp, R_SS) - 1;
	cpu.esp += 4;
	print_asm(str(instr) " %x", cpu.eip + 1 + DATA_BYTE);
	return 1;
}

make_helper(ret_i) {
	uint32_t imm = instr_fetch(cpu.eip + 1, 2);
	cpu.eip = MEM_R(cpu.esp, R_SS) - 3;
	cpu.esp += 4 + imm;
	print_asm(str(instr) " %x", cpu.eip + 1 + DATA_BYTE);
	return 3;
}
#endif

#include "cpu/exec/template-end.h"
